/**
 * 
 */
package com.thon.task.post;

import com.thon.task.Task;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @author THON
 * @email thon.ju@meet-future.com
 * @date 2011-11-27 下午04:36:02
 * @description:
 */
@Aspect
@Component
public class PostAspect {
	
	@Autowired
	private Task postViewCountTask;


	/**
	 * 记录post浏览量
	 * @param jp
	 */
	@AfterReturning("execution(*  com.thon.service.post.PostService.lookPost(..))")
	public void doPostViewCount(JoinPoint jp) throws Exception {
		Map<Object, Object> context =new HashMap<Object, Object>();
		context.put("id", jp.getArgs()[0]);

		postViewCountTask.doAsyncTask(context);
	}
}
